package org.cn.springcloudvv.cxf.service;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import org.cn.springcloudvv.cxf.vo.User;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p><em>Created on 2022/4/12 10:53 下午</em></p>
 *
 * @author fuzhongtang
 * @since 1.0.1
 */
@Service
public class UserService {

    public User queryUserFromMysql(User user)
    {
        User user1 = new User();
        user1.setUserId(user.getUserId());
        user1.setUserName(user.getUserName()+"-query-from-Restful-Api-["+ DateUtil.format(new Date(), DatePattern.ISO8601_PATTERN)+"]");
        user1.setAge(user.getAge());
        user1.setPhone(user.getPhone());
        return user1;
    }

    public User saveUser(User user)
    {
        User user1 = new User();
        user1.setUserId(user.getUserId());
        user1.setUserName(user.getUserName()+"-saveUser-toMysql-from-Restful-Api-["+DateUtil.format(new Date(), DatePattern.ISO8601_PATTERN)+"]");
        user1.setAge(user.getAge());
        user1.setPhone(user.getPhone());
        return user1;
    }

}
